﻿using System.Collections.Generic;
using System.Linq;
using X23.Application.Dto;
using X23.Application.RoleManagement.Dto;

namespace X23.Application.UserManagement.Dto
{
    /// <summary>
    /// 用户信息
    /// </summary>
    public class UserDto : IntDto
    {
        /// <summary>
        /// 用户姓名
        /// </summary>
        [DtoExport("姓名")]
        public string Name { get; set; }

        /// <summary>
        /// 账号
        /// </summary>
        [DtoExport("账号")]
        public string Account { get; set; }

        ///// <summary>
        ///// 密码
        ///// </summary>
        //public string Password { get; set; }

        /// <summary>
        /// 微信账号
        /// </summary>
        [DtoExport("微信账号")]
        public string WeChatId { get; set; }

        /// <summary>
        /// 角色列表
        /// </summary>
        public List<RoleDto> RoleDtoList { get; set; }

        /// <summary>
        /// 角色列表字符串 只读
        /// </summary>
        [DtoExport("角色列表", 20)]
        public string RoleDtoListStr
        {
            get => RoleDtoList != null && RoleDtoList.Count > 0 ? string.Join(",", RoleDtoList.Select(x => x.Name).ToArray()) : "";
        }
        /// <summary>
        /// 角色Ids
        /// </summary>
        public List<int> RoleIds { get; set; }
    }


    public class LoginUserDto : IntDto
    {
        /// <summary>
        /// 账号
        /// </summary>
        public string Account { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
    }
    public class UserPasswordDto : IntDto
    {
        /// <summary>
        /// 旧密码
        /// </summary>
        public string OldPassword { get; set; }
        /// <summary>
        /// 新密码
        /// </summary>
        public string NewPassword { get; set; }
    }
}
